home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / www / src / WWW / Daemon / Implementation / CommonMakefile next >
Encoding:
Makefile  |  1993-06-03  |  7.6 KB  |  267 lines

  1. #    Common Makefile for WWW Servers and some Gateways
  2. #    -------------------------------------------------
  3. #
  4. # A Makefile in a subdirectory for the machine in question contains
  5. # the necessary definitions of directories etc.
  6. #
  7. #    (c) CERN 1990, 1991 -- see Copyright.html for conditions
  8. #
  9. #    YOU NEED THE WWW LIBRARY TO USE THIS
  10. #
  11. # This file should be invariant between systems.
  12. #    DEPENDENCIES NOT COMPLETE @@
  13. #
  14. #    make        Compile and link the daemon (private version)
  15. #    make install    Copy it into the system (implies make)
  16. #    make update    Copy installed version into installed version
  17. #    make uninstall    Unlink installed version from the system
  18. #    make clean    Remove intermediate files
  19. #    make cleanall    Remove intremediate files and products
  20. #
  21. #    make httpd    as make
  22. #    make tigate    Make Techinfo gateway
  23. #
  24. #    
  25. # Macros required to be defined already for make:
  26. #
  27. # CC        The C compiler
  28. # CFLAGS2    Flags for $(CC)
  29. # LFLAGS    Flags for ld
  30. # WWW        Root of WWW source tree
  31. # WTMP        Root of tree in which to put objects e.g. $(WWW) or /tmp
  32. #
  33. # Only needed for use as WAIS gateway. Put into your Makefile.include
  34. # Also have a WAIS-connected version of the libwww.
  35. #
  36. #    WAIS = ../../../freeWAIS
  37. #    WAISLIB =  $(WAIS)/bin/client.a $(WAIS)/bin/wais.a
  38. #
  39. #______________________________________________________________________
  40.  
  41. #  If this env var is set to something else Some makes will use that instead
  42. SHELL = /bin/sh
  43. #  Rule file to be used by target daemon
  44. RULE_FILE = "/etc/httpd.conf"
  45.  
  46. CMN = $(WWW)/Library/Implementation
  47. INC = $(WWW)/Library/Implementation
  48. SRC = $(WWW)/Daemon/Implementation
  49. OBJ = .
  50. OE = $(OBJ)/.created
  51.  
  52. DOC = \
  53.     $(WWW)/Paper/www-server-guide.ps, $(WWW)/Paper/www-server-guide.txt
  54.  
  55. CFLAGS2 =  -I$(INC) -DDEBUG $(CFLAGS)
  56.  
  57. PROD = httpd
  58.  
  59. USELIBDIR = $(WTMP)/Library/$(WWW_MACH)
  60. OBJ = $(WTMP)/Daemon/$(WWW_MACH)
  61. LIBWWW = $(WTMP)/Library/$(WWW_MACH)/libwww.a
  62.  
  63. OBJS = HTDaemonDIR.o HTRetrieve.o HTSInit.o $(LIBWWW) $(WAISLIB)
  64. FOBJS = HTDaemonNR.o FINDGate.o  $(LIBWWW)
  65. TIOBJS = HTDaemonNR.o TechInfoGate.o  $(LIBWWW)
  66. WOBJS = HTDaemonNR.o WAISGate.o ParseWSRC.o $(LIBWWW)
  67. TWOBJS = test.o WAISGate.o  $(LIBWWW)
  68.  
  69.  
  70. SPECIFIC = $(SRC)/Makefile.decstation    \
  71.     $(SRC)/Makefile.next
  72.  
  73. SOURCES = $(SRC)/HTDaemon.c    $(SRC)/HTDaemon.h \
  74.     $(SRC)/HTRetrieve.c    \
  75.     $(SRC)/HTSInit.c    \
  76.     $(SRC)/DCLServer.c    $(SRC)/VMServer.c    \
  77.     $(SRC)/VMSHelpGate.c    $(SRC)/TechInfoGate.c    \
  78.     $(SRC)/CommonMakefile    $(SRC)/Makefile        \
  79.     $(SRC)/install.csh    $(SRC)/Version.make    \
  80.     $(SRC)/test.c
  81.  
  82.  
  83. include $(ABS)$(SRC)/Version.make
  84.  
  85. #        Hypertext File server
  86.  
  87. $(PROD) : $(OBJS)
  88.     $(CC) -o $(PROD)_$(VD)  $(OBJS) $(LFLAGS)
  89.     -rm $(PROD)
  90.     ln -s $(PROD)_$(VD) $(PROD)
  91.  
  92. HTRetrieve.o : $(SRC)/HTRetrieve.c $(INC)/HTUtils.h $(INC)/tcp.h \
  93.     $(INC)/HTFile.h
  94.     $(CC) -c $(CFLAGS2) -DRULES -DRULE_FILE=\"$(RULE_FILE)\" $(SRC)/HTRetrieve.c
  95.  
  96.  
  97. $(USELIBDIR)/libwww.a :
  98.     @echo You must get and make the WWWLibrary product first!
  99.     (cd $(WWW)/Library/$(WWW_MACH) && make)
  100.  
  101. lib :
  102.     (cd $(WWW)/Library/$(WWW_MACH) && make)
  103.  
  104. # Things we check on all platforms and export binaries
  105.  
  106. all : httpd tigate
  107.     echo "httpd and tigate daemons up to date"
  108.  
  109.  
  110. #         FIND gateway - test only (has to run on VM!)
  111.  
  112. FINDGate : $(FOBJS)
  113.     $(CC) -o FINDGate $(FOBJS) $(LFLAGS)
  114. FINDGate.o : $(SRC)/FINDGate.c $(INC)/HTUtils.h $(INC)/tcp.h
  115.     $(CC) -c $(CFLAGS2) $(SRC)/FINDGate.c
  116.  
  117. #        Techinfo Gateway
  118.  
  119. tigate : $(TIOBJS)
  120.     $(CC) $(LFLAGS) -o tigate $(TIOBJS)
  121.  
  122. TechInfoGate.o : $(SRC)/TechInfoGate.c
  123.     $(CC) $(CFLAGS2) -c -o $@ $(SRC)/TechInfoGate.c
  124.  
  125. #         WAIS Gateway is just httpd linked with freeWAIS
  126. #    and a libwww copmpiled with the right flags.
  127.  
  128. #         Common Code
  129.  
  130. test.o : $(SRC)/test.c $(INC)/HTUtils.h $(INC)/tcp.h $(INC)/HTTCP.h
  131.     $(CC) -c $(CFLAGS2) -DRULES -DRULE_FILE=\"$(RULE_FILE)\" $(SRC)/test.c
  132. HTDaemon.o : $(SRC)/HTDaemon.c $(INC)/HTUtils.h $(INC)/tcp.h $(INC)/HTTCP.h
  133.     $(CC) -c $(CFLAGS2) -DRULES -DRULE_FILE=\"$(RULE_FILE)\" \
  134.      -DVD=\"$(VD)\" $(SRC)/HTDaemon.c
  135. #
  136. #  The following are version of the daemon code with different options.
  137. #  They have to be makde with a copy of the source because the -o
  138. #  option does not work for object files for the AIX compiler! :-(
  139. #
  140. HTDaemonNR.o : $(SRC)/HTDaemon.c $(INC)/HTUtils.h $(INC)/tcp.h $(INC)/HTTCP.h
  141.     cp $(SRC)/HTDaemon.c $(OBJ)/HTDaemonNR.c
  142.     $(CC) -c $(CFLAGS2) -DNOCONVERT -DVD=\"$(VD)\"  $(OBJ)/HTDaemonNR.c
  143.     rm $(OBJ)/HTDaemonNR.c
  144. HTDaemonDIR.o : $(SRC)/HTDaemon.c $(INC)/HTUtils.h $(INC)/tcp.h \
  145.     $(INC)/HTTCP.h
  146.     cp $(SRC)/HTDaemon.c HTDaemonDIR.c
  147.     $(CC) -c $(CFLAGS2)  -DRULES \
  148.     -DRULE_FILE=\"$(RULE_FILE)\" -DDIR_OPTIONS  -DVD=\"$(VD)\" \
  149.         HTDaemonDIR.c
  150.     rm HTDaemonDIR.c
  151.  
  152. HTSInit.o : $(SRC)/HTSInit.c
  153.     $(CC) -c $(CFLAGS) -I$(CMN) $(SRC)/HTSInit.c
  154.  
  155. #_________________________________________________________________________
  156. #    Install the server
  157.  
  158. install :    $(PROD)
  159.     csh $(SRC)/install.csh
  160.  
  161. #    Link system to the binary and documentation in this tree
  162.  
  163. link : Works/$(PROD)
  164.     ln -s `pwd`/$(PROD) $(BINDIR)/$(PROD)
  165.     - mkdir /usr/local
  166.     - mkdir /usr/local/lib
  167.     ln -s $(DEFAULTS) /usr/local/lib/WWW
  168.  
  169. uninstall :
  170.     rm $(BINDIR)/$(PROD)
  171.     rm -r /usr/local/lib/WWW
  172.  
  173. #    Clean up everything generatable except final products
  174. #    Including obj directory UNLESS there is anything else in it
  175. clean :
  176.     - rm $(OBJ)/.created $(OBJ)/*.o
  177.     - rmdir $(OBJ)
  178.  
  179. #    Clean up everything generatable including final products
  180.  
  181. cleanall : clean
  182.     - rm $(PROD)
  183.  
  184. #    Binary release
  185. #
  186. #    Must be done on anonymous FTP server!
  187. #
  188. #  This makefile does not knw how to make $(PROD)_$(VD) so that trying
  189. #  to make binay or asis on a weird machine doesn't try to build $(PROD)!
  190.  
  191. binary : $(PROD)_$(VD)
  192.     -mkdir /pub/www/bin/$(WWW_MACH)
  193.     cp $(PROD)_$(VD) /pub/www/bin/$(WWW_MACH)/$(PROD)_$(VD)
  194.  
  195. #    ASIS installation
  196. #    -----------------
  197. #    Can only happen on an allocated ASIS development machine and
  198. #    with uid of the controlling user for the project.
  199. #
  200. asis :  /asis/specific/$(ASIS_MACH)/usr.local/bin/$(PROD)
  201.     touch asis
  202.     echo ASIS distribution is now up-to-date.
  203.  
  204. /asis/specific/$(ASIS_MACH)/usr.local/bin/$(PROD) : $(PROD)_$(VD)
  205.     cp $(PROD)_$(VD) /asis/specific/$(ASIS_MACH)/usr.local/bin/$(PROD)_$(VD)
  206.     rm -f /asis/specific/$(ASIS_MACH)/usr.local/bin/$(PROD)
  207.     ln -s $(PROD)_$(VD) \
  208.         /asis/specific/$(ASIS_MACH)/usr.local/bin/$(PROD)
  209.  
  210. #    CERNLIB installation
  211. #    --------------------
  212. #    Assuming the cernlib-style directory structure
  213. #    Warning: Not suitable for machine-shared file structure.
  214. #
  215. cernlib :    $(PROD)
  216.     - mkdir $(CERNLIBBIN)
  217.     cp $(PROD) $(CERNLIBBIN)
  218.  
  219.  
  220. #_________________________________________________________________________    
  221.  
  222.  
  223. #    Check directory exists
  224. $(OE) :
  225.     -mkdir $(WTMP)
  226.     -mkdir $(WTMP)/Daemon
  227.     -mkdir $(WTMP)/Daemon/$(WWW_MACH)
  228.     touch $(OE)
  229.  
  230.  
  231. #_________________________________________________________________
  232. # For W3 Administrative use only:
  233.  
  234.  
  235. #        W3 Source + documentation release
  236. #        ---------------------------------
  237.  
  238. distribute :  /pub/www/README.txt /pub/www/Copyright.txt $(SOURCES)
  239.     (cd $(WWW)/.. && WWW=WWW ABS=`pwd`/ make $(MFLAGS) \
  240.         -f WWW/Daemon/Implementation/CommonMakefile \
  241.         /pub/www/src/WWWDaemon_$(VD).tar.Z)
  242.     @ echo Distribution of Daemon version $(VD) up to date.
  243.  
  244. # THIS MUST BE BUILT FROM THE DIRECTORY ABOVE WWW ! USE distribute above!
  245. /pub/www/src/WWWDaemon_$(VD).tar.Z : $(SOURCES)
  246.     tar cvf /pub/www/src/WWWDaemon_$(VD).tar \
  247.         $(SOURCES) $(DOC)
  248.     compress /pub/www/src/WWWDaemon_$(VD).tar
  249.  
  250. #________________________________________________________________________
  251. #        Hypertext supplied in text format
  252. #        ---------------------------------
  253.  
  254. $(WWW)/README.txt : $(WWW)/../README.html
  255.     www -n -p66 http://info.cern.ch/hypertext/README.html \
  256.         > $(WWW)/README.txt
  257. /pub/www/README.txt : $(WWW)/README.txt
  258.     cp $(WWW)/README.txt /pub/www/README.txt
  259.  
  260. $(WWW)/Copyright.txt : $(WWW)/../Copyright.html
  261.     www -n -p66 http://info.cern.ch/hypertext/Copyright.html \
  262.         > $(WWW)/Copyright.txt
  263. /pub/www/Copyright.txt : $(WWW)/Copyright.txt
  264.     cp $? $@
  265.  
  266.  
  267.